package study.itheima.dao;

import org.apache.ibatis.annotations.*;
import study.itheima.domain.Items;
import study.itheima.domain.Orders;
import study.itheima.domain.User;

import java.util.List;
//查找所有订单及其所属用户信息(注解查询一对一)和所包含商品信息(注解查询多对多)
public interface OrdersMap {
    @Select("select * from orders")
    @Results(id = "ordermap",value = {
            @Result(property = "user",javaType = User.class,column = "user_id",one = @One(select = "study.itheima.dao.UserMap.findByOid")),
            @Result(property = "itemsList",javaType = List.class,column = "id",one = @One(select = "study.itheima.dao.ItemsMap.findByOid"))
    })
    List<Orders> findAll();
}
